/**   
 * Copyright © 2016  All rights reserved.
 * 
 * @Title: ConsoleHandler.java 
 * @Project: clusterntss
 * @Package: com.jndk.netty 
 * @Description: 请用一句话描述
 * @author: yuanzhenghe
 * @date: 2016年12月9日 上午10:46:09 
 * @version: V1.0   
 */
package com.jndk.netty;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/** 
 * @ClassName: ConsoleHandler 
 * @Description: 请用一句话描述
 * @author: yuanzhenghe
 * @date: 2016年12月9日 上午10:46:09  
 */
public class ConsoleHandler extends ChannelInboundHandlerAdapter {

	/* (non Javadoc) 
	 * @Title: channelRead
	 * @Description: 请用一句话描述
	 * @param ctx
	 * @param msg
	 * @throws Exception 
	 * @see io.netty.channel.ChannelInboundHandlerAdapter#channelRead(io.netty.channel.ChannelHandlerContext, java.lang.Object) 
	 */
	@Override
	public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
		
		System.out.println(msg);
		
		ctx.write(msg);
	}

	/* (non Javadoc) 
	 * @Title: channelReadComplete
	 * @Description: 请用一句话描述
	 * @param ctx
	 * @throws Exception 
	 * @see io.netty.channel.ChannelInboundHandlerAdapter#channelReadComplete(io.netty.channel.ChannelHandlerContext) 
	 */
	@Override
	public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
		
		ctx.flush();
		
	}

	
}
